import {
  getColorHexRGB,
  darwinGetScreenPermissionGranted,
  darwinRequestScreenPermissionPopup
} from 'electron-color-picker'

export const pickColor = async (): Promise<string> => {
  const p = await darwinGetScreenPermissionGranted()
  if (!p) {
    await darwinRequestScreenPermissionPopup()
    return ''
  }

  return (await getColorHexRGB()) as string
}
